package com.cagtwitter.services;

import java.util.Collections;
import java.util.ArrayList;

public class MiscServices {
	public String toSearchQuery(String text){
		return text.replaceAll(" ","+").toLowerCase();
	}
	
	public String toId(String text){
		String textUrl = text.toLowerCase();
		textUrl = textUrl.replaceAll("ö","o");
		textUrl = textUrl.replaceAll("ğ","g");
		textUrl = textUrl.replaceAll("ı","i");
		textUrl = textUrl.replaceAll("ş","s");
		textUrl = textUrl.replaceAll("ü","u");
		textUrl = textUrl.replaceAll("ç","c");
		textUrl = textUrl.replaceAll(" ","");
		textUrl = textUrl.replaceAll("-","");
		return textUrl;
	}
	
	public String getCarouselContentStringAsHtml(String img_source,String text){
		return "<div class='slide_inner'><a target='_blank' class='photo_link' href='#'><img class='photo' src='"+img_source+"' alt='"+img_source+"'></a><a target='_blank' class='caption' href='#'>"+text+"</a></div>";
	}
	
	public String getCarouselContentButtonStringAsHtml(String img_source,String text){
		return "<div class='thumb'><img src='"+img_source+"' alt=''></div><p>"+text+"</p>";
	}
	
	public ArrayList<Integer> generateRandomNumbers(int quantity,int min,int max){
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = min; i < max; i++){
	       numbers.add(i);
	    }
		Collections.shuffle(numbers);
		
		return numbers;
	}

}
